<div class="options">
	<img src="/images/icons/script_add.png"> 
	<%= link_to "Propose A Bill", :controller => 'bills', :action => 'new' %>
  	<img src="/images/icons/rss.png"> 
	<%= link_to "Bill Updates Feed", :controller => 'rss', :action => 'bills' %></li>
	<img src="/images/icons/rss.png"> 
	<%= link_to "Bill Comments Feed", :controller => 'rss', :action => 'comments' %></li>      
</div> 

<h1 class="nicetitle">Browse Bills</h1>

<div class="searchbar">    
	<%= start_form_tag :action => 'list' %>
		<img src="/images/icons/magnifier.png">
		<input name="search">
		<input type="submit" value="Search Bills">
	<%= end_form_tag %>
</div>

<% if @search %>
<h2 class="simpletitle">Bills matching '<%= @search %>'</h2>                                         
<table class="simple">
<% if @bills_searched.empty? %>	
	<em>No bills match</em>
<% else %>
	<% @bills_searched.each do |bill| %>                                                   
	  <% if bill.current_version %>
	  <tr>
		<td valign="top"><img src="/images/icons/script.png"></td>
		<td nowrap valign="top"><%= link_to highlight(bill.current_version.title, @search), :action => 'show', :id => bill %></td>
		<td valign="top"><span class="small light"><%= highlight bill.current_version.preview(@search), @search %></span></td>
		</tr>
	  <% end %>
	<% end %>
<% end %>
</table>           
<% end %>  
             
<% if @bills_tagged %>
<h2 class="simpletitle">Bill tagged with '<%= @tag %>'</h2>                                         
<ul class="simple">
<% @bills_tagged.each do |bill| %>                                                   
  <% if bill.current_version %>
  <li><img src="/images/icons/script.png">
	<%= link_to bill.current_version.title, :action => 'show', :id => bill %>
			<span class="small light">(<%= truncate bill.current_version.billtext, 70 %>)</span></li>
  <% end %>
<% end %>
</ul>           
<% end %>

<div class="yui-gb">

<div class="yui-u first">    
	<h2 class="simpletitle">Recent Bills</h2>                                         
	<ul class="simple">
	<% @recent_bills.each do |bill| %>                                                   
	  <% if bill.current_version %>
	  <li><img src="/images/icons/script.png">
		<%= link_to truncate(bill.current_version.title,20), :action => 'show', :id => bill %>
		<span class="small light">(<%= tiny_date bill.current_version.created_at %>)</span></li>
	  <% end %>
	<% end %>
	</ul>
</div>

<div class="yui-u">    
	<h2 class="simpletitle">Popular Bills</h2>
	<ul class="simple">
	<% @popular_bills.each do |bill| %>
	  <% if bill.current_version %>
	  <li><img src="/images/icons/script.png">
	  <%= link_to truncate(bill.current_version.title,20), :action => 'show', :id => bill %>
     	<span class="small light">(<%= bill.sponsor_count %>)</span></li>
	  <% end %>
	<% end %> 
	</ul>
</div>

<div class="yui-u">    
	<h2 class="simpletitle">Bill Tags</h2>
		<% Bill.tag_list.each do |tag| %>
		<span class="tag" style="whitespace: nowrap">
			<small><%= tag.count %></small> 
			<%= link_to tag.name, :action => 'list', :tag => CGI::escape(tag.name) %>
		</span>
		<% end %>
</div>

</div>
 
